Question: Let $f(x, y) = \cos(x) + \sin(y)$. What is the Hessian of $f$ ? Choose 1 answer: Choose 1 answer: (Choice A) A $\begin{bmatrix} -\sin(x) & 0 \\ \\ 0 & -\cos(y) \end{bmatrix}$ (Choice B) B $\begin{bmatrix} -\cos(x) & 0 \\ \\ 0 & -\sin(y) \end{bmatrix}$ (Choice C) C $\begin{bmatrix} 0 & -\cos(x) \\ \\ -\sin(y) & 0 \end{bmatrix}$ (Choice D) D $\begin{bmatrix} -\sin(x) & \cos(y) \\ \\ -\cos(x) & -\sin(y) \end{bmatrix}$
Solution: The Hessian of a scalar field $f$ is the matrix that contains all its second-order partial derivative information. $\bold{H}(f) = \begin{bmatrix} f_{xx} & f_{xy} \\ \\ f_{yx} & f_{yy} \end{bmatrix}$ Because the order of mixed partial derivatives often doesn't matter, the bottom left and top right entries of the Hessian are usually the same. Let's calculate the second order partial derivatives of $f$ ! $\begin{aligned} f_{xx} &= \dfrac{\partial}{\partial x} \left[ -\sin(x) \right] = -\cos(x) \\ \\ f_{yx} &= \dfrac{\partial}{\partial y} \left[ -\sin(x) \right] = 0 \\ \\ f_{xy} &= \dfrac{\partial}{\partial x} \left[ \cos(y) \right] = 0 \\ \\ f_{yy} &= \dfrac{\partial}{\partial y} \left[ \cos(y) \right] = -\sin(y) \end{aligned}$ Now we can put all the second-order partial derivatives together into the Hessian. $\bold{H}(f) = \begin{bmatrix} -\cos(x) & 0 \\ \\ 0 & -\sin(y) \end{bmatrix}$